<?php 

$base = [
	'/admin'=>'/admin/index/index',
	''=>'/home/index/index',
	'/search'=>'/home/content/search',
	'/channel/{$id}'=>'/home/content/index',
	'/detail/{$id}'=>'/home/content/detail',
	'/plugin/{$_plug_name}/{$_plug_controller}-{$_plug_action}'=>'/home/plugin/index',
];

switch (\Ebcms::config('url_type')) {
	case '0':
		return [];
		break;

	case '1':
		return $base;
		break;

	case '2':
		return array_merge(getPath(), $base);
		break;
	
	default:
		return [];
		break;
}

function getPath(){
	$res = [];
	$channels = \Channel::get();
	if (is_array($channels)) {
		foreach ($channels as $key => $value) {
			if ($value['type'] == 'list') {
				$res[$value['path'] . '/{$id}'] = [
					'path' => '/home/content/detail',
					'param'=>[
						'channel_id'=>$value['id'],
						'id'=>'*'
					],
					'method'=>[]
				];
				$res[$value['path'] . '_{$page}'] = [
					'path' => '/home/content/index',
					'param'=>[
						'id'=>$value['id'],
						'page'=>'*'
					],
					'method'=>[]
				];
			}
			$res[$value['path']] = [
				'path' => '/home/content/index',
				'param'=>[
					'id'=>$value['id']
				],
				'method'=>[]
			];
		}
	}
	return $res;
}